package com.huatai.bpmn.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.huatai.bpmn.entity.BasicLoadEntity;
import com.huatai.bpmn.entity.vo.DataVo;
import com.huatai.bpmn.entity.vo.PageVo;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.*;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author yxy
 * @since 2023-07-07
 */
public interface BasicLoadService extends IService<BasicLoadEntity> {
	/**
	 * 获取项目库数据
	 *
	 * @return
	 */
	IPage pageList(JSONObject data);

	/**
	 * 获取项目库数据
	 *
	 * @return
	 */
	List<JSONObject> listByPlaceAndBusinessKey(String place,String businessKey);

	/**
	 * 表单数据新增
	 * @param data
	 * @return
	 */
	boolean add(JSONObject data,String place,String uuid);

	/**
	 * 表单数据新增
	 * @param data
	 * @return
	 */
	boolean update(JSONObject data,String businessKey);

	/**
	 * 表单数据删除
	 * @param businessKey
	 * @return
	 */
	boolean remove(String businessKey);

	/**
	 * 表单数据新增多条数据  data参数place，businessKey（“审批id”）,表单对应key-value
	 * @param data
	 * @return
	 */
	boolean addList(List<JSONObject> data,String businessKey);

	/**
	 * 表单数据新增多条数据 map存储多个表单数据
	 * @return
	 */
	boolean addList(HashMap<String,List<JSONObject>> map,String businessKey);

	/**
	 * 表单数据新增多条数据 map存储多个表单数据
	 * @return
	 */
	boolean addList(String place,List<JSONObject> data,String businessKey);
	/**
	 * 根据BusinessKey获取项目库数据
	 *
	 * @return
	 */
	List<JSONObject> pageListByBusinessKey(JSONObject data);

	/**
	 * 表单数据修改多条数据  data参数place，businessKey（“审批id”）,表单对应key-value
	 * @param data
	 * @return
	 */
	boolean updateList(List<JSONObject> data, String businessKey);

	List<BasicLoadEntity> listByFlowId(String flowId);

	/**
	 * 根据businessKey查询表单标识
	 * @param businessKey
	 * @return
	 */
	List<String> findPlaceByBusinessKey(String businessKey);

	/*HashMap<String, Object> createTask(String externalParameterId,String deployId);*/

	/**
	 * 项目数据查询
	 * @param dataVo
	 */
	JSONObject pageDataList(DataVo dataVo);
	/**
	 * 数据转入实施库
	 *	@param businessKey
	 * @return
	 */
	boolean shiftSS(String businessKey,String myKey);


	/**
	 * 部门老大根据归口部门查询数据
	 * @return
	 */
	List<String> getFlowList(String myKey, String deptName,int pgIndex,int pgSize);

	/**
	 * 员工查询数据
	 * @return
	 */
	List<String> getFlowList1(String myKey, String getRealName,String jsonKey,int pgIndex,int pgSize);
	/**
	 * 查看详情
	 *	@param businessKey
	 * @return
	 */
	HashMap<String, Object> getInfo(String myKey,String businessKey);


	/**
	 * 根据flow_id删除表格数据
	 * @param flowId
	 * @return
	 */
	boolean removeByFlowId(String flowId);

	/**
	 * 表格数据修改-表单表格
	 * @param jsonObject
	 * @param businessKey
	 * @return
	 */
	boolean updateByBusinessKey(JSONObject jsonObject, String businessKey);

	int getFlowListCount(String myKey, String deptName);

	int getFlowList1Count(String myKey,String jsonKey, String getRealName);

	/**
	 * 数据分析-项目总览
	 */
	JSONObject dataAnalyse(int year);

	List<String> getFlowListByMyKey(String myKey, String deptName, int pgIndex, int pgSize);

	int getFlowListCountByMyKey(String myKey, String deptName);

	List<String> getFlowList1ByMyKey(String myKey, String realName, int pgIndex, int pgSize);

	int getFlowList1CountByMyKey(String myKey, String realName);

	List<String> getFlowListByMyKeyStr(String myKey, String deptName, int pgIndex, int pgSize,String str);

	int getFlowListCountByMyKeyStr(String myKey, String deptName,String str);

	List<String> getFlowListStr(String myKey, String deptName, int pgIndex, int pgSize, String str);

	int getFlowListCountStr(String myKey, String deptName, String str);

	List<String> getFlowList1ByName(String myKey, String realName, int pgIndex, int pgSize, String str);

	int getFlowList1CountByName(String myKey, String realName, String str);

	void removeByBusinessKey(String flowId);

	/**
	 * 根据flowId查询项目值
	 * @param flowId
	 * @return
	 */
    String getPmpValue(String key,String flowId);


	String getPmpValueByBus(String keyXmmc, String tableId);

	/**
	 *
	 * @param myKey
	 * @return
	 */
	String dowLoadExcel(String myKey,HttpServletResponse response);

    void removeByKey(String jsonKey);

	HashMap<String, Object> getParamData(String myKey, String flowId);

	/**
	 * 模板导出
	 * @param myKey
	 * @return
	 */
	String template(String myKey, HttpServletResponse response);

	/**
	 * 数据导入
	 * @param myKey
	 * @return
	 */
	boolean importExcel(String myKey, MultipartFile file);

	/**
	 * 新数据分析-项目总览
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	HashMap<String, Object> newDataAnalyse(String startTime, String endTime);
}
